<?php

/**
 * 文件名：login.mod.php
 * @version $Id: login.mod.php 5261 2013-12-13 03:02:47Z chenxianfeng $
 * 作者：狐狸<foxis@qq.com>
 * 功能描述：用户登录
 */
if (!defined('IN_JISHIGOU')) {
    exit('invalid request');
}

class ModuleObject extends MasterObject {

    function ModuleObject(& $config) {
        $this->MasterObject($config);


        $this->Execute();
    }

    function Execute() {
        ob_start();
        switch ($this->Code) {
            case 'demo':
                $this->Demo();
                break;
            default:
                $this->Main();
                break;
        }
        response_text(ob_get_clean());
    }

    function Main() {
        response_text("正在建设中……");
    }
    public function Demo() {
        phpinfo();exit;
        $file = 'http://182.118.58.55/youku/6973A7A8CEE468218929CF48C7/0300080100568EB4E01D481392358E470EE803-E19E-E368-6AB4-75AD7238D48A.mp4';
        $time = '1';
        $name = 'aa.jpg';
        $result = $this->getVideoCover($file, $time,$name);
        var_dump($result);
    }
    function getVideoCover($file, $time) {
        if (empty($time))
            $time = '1'; //默认截取第一秒第一帧
        $strlen = strlen($file);
        //$videoCover = substr($file,0,$strlen-4);
        //$videoCoverName = $videoCover.'.jpg';//缩略图命名
        //exec("ffmpeg -i ".$file." -y -f mjpeg -ss ".$time." -t 0.001 -s 320x240 ".$name."",$out,$status);
        $str = "ffmpeg -i " . $file . " -y -f mjpeg -ss 3 -t " . $time . " -s 320x240 " . $name;
        //echo $str."</br>";
        $result = system($str);
        return $result;
    }
}

?>